<template>    

<head>
<meta charset="utf-8">
<title>Index Template</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge">    
</head>

<!--BEGIN HEADER-->
<div class="pure-menu pure-menu-open pure-menu-horizontal pure-menu-fixed head-menu">
    <a href="#" class="pure-menu-heading"><h3>物联网-金额管理平台</h3></a>
    <ul>
        <li class="pure-menu-selected"><a href="#">主页</a></li>
        <li><a href="#" @click="TakeInfo('IM')" v-show="SearUType.UT_Name=='管理员'" >项目管理</a></li>
        <li><a href="#" @click="TakeInfo('TZ')">投资管理</a></li>
        <li><a href="#" @click="TakeInfo('LC')" >理财管理</a></li>
        <li><a href="#">标签页</a></li>
    </ul>
    <div class="head-menu-info">
        欢迎您，{{ SearUType.UT_Name }} <a href="#"> {{ SearUType.UL_Name }} </a>。您选择【首页】【退出】
    </div>
</div>
<!--END HEADER-->
<div class="pure-g content">
    <div class="pure-u">
        <div class="side">
        </div>
    </div>
    <div class="pure-u-1">
        <div class="main">
            <div class="panel panel-default">
                <div class="panel-title">

                    <div v-show="Imanage">
                        <InvestShow></InvestShow>
                    </div>
                    
                    <div v-show="TZmanage && SearUType.UT_Name=='管理员' "><!-- 投资 -->
                        <UserInvest></UserInvest>
                    </div>

                    <div v-show="TZmanage && SearUType.UT_Name=='普通用户' "><!-- 投资 -->
                        <ShowUserInvest></ShowUserInvest>
                    </div>

                    <div ><!-- 理财 -->

                    </div>

                    <div><!-- 理财 -->

                    </div>

                </div>
            </div>


            
            
          
        </div>
    </div>
</div>
<!--BEGIN FOOT-->
<div class="pure-g copyright">
    <div class="pure-u-1"> 2013 © TWStudio Admin Dashboard Template. </div>
</div>

</template>

<script setup lang="ts">

import { ref,onMounted } from 'vue'
import axios from 'axios'
import {useUserStore} from '../store/index.ts'
import InvestShow from './Invest/InvestShow.vue'
import UserInvest from './Invest/UserInvest.vue'
import ShowUserInvest from './Invest/ShowUserInvest.vue'


const SearUType = ref({
    UT_Name:'',
    UL_Name:''
})

const userStore = useUserStore()

console.log(userStore.Uid);

onMounted( ()=>{
    SearUserType();
})

const SearUserType = () => {
    axios({
        method:"get",
        url:"http://localhost:56707/api/User/SearUserType",
        params:{
            UId:userStore.Uid
        }
    })
    .then(res => {
        console.log(res);
        SearUType.value = res.data[0];
    })
    .catch(err => {
        console.log(err);
    })
}

const Imanage = ref(false)
const TZmanage = ref(false)
const LCmanage = ref(false)
const TakeInfo = (msg:string) => {
    switch(msg){
        case 'IM':
            Imanage.value = true;
            TZmanage.value = false;
            LCmanage.value = false;
        break;

        case 'TZ':
            TZmanage.value = true;
            Imanage.value = false;
            LCmanage.value = false;    
        break;

    }
}

</script>
